package demo.java.springboot.property;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;

@SpringBootApplication
public class PropertyApp {
	private static Logger LOG = LogManager.getLogger(PropertyApp.class);

	@Bean
	@Conditional(UserCondition.class)
	User createUser () {
		return new User();
	}
	
	public static void main(String[] args) {
		ApplicationContext context = SpringApplication.run(PropertyApp.class, args);
		User u = context.getBean("createUser", User.class);
		LOG.info(u);
	}
}
